package com.neoCalf.neoNotify.controller;

import com.neoCalf.neoCommon.enums.MqType;
import com.neoCalf.neoCommon.model.R;
import com.neoCalf.neoNotify.service.NotifyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;


/**
 * @author 小牛
 * @version 1.0
 * @description TODO
 * @date 2025/4/8 17:16
 */
@RestController
@RequestMapping("/notify")
public class NotifyController {
    @Resource
    private NotifyService notifyService;

    @PostMapping("/phone")
    public R<String> phoneNotify(@RequestParam("phone") @NotEmpty String phone) {
        notifyService.sendMessage(phone, MqType.SEND_PHONE_MESSAGE);
        return R.ok();
    }

    @PostMapping("/email")
    public R<String> emailNotify(@RequestParam("email") @NotEmpty String email) {
        notifyService.sendMessage(email, MqType.SEND_EMAIL_MESSAGE);
        return R.ok();
    }
}
